<html>
    <head>
        <title>发表帖子</title>
        <link rel="stylesheet" href="/static/css/browse.css" type="text/css" />
        <script type="text/javascript" src="/static/js/jquery-1.10.2.js"></script>	
        <script type="text/javascript">
            var display_list = [1,2,3,4,5,6,7,8,9,10,11,12,13]
            function show(item_list){
                for (i=0; i<display_list.length;i++){
                    $("#t"+display_list[i]).hide();
                }
                for (i=0; i<item_list.length;i++){
                    $("#t"+item_list[i]).show();
                }
            }

            function onchange(){
                var actval = $("#id_actype").val();
                var typeval = $("#id_ttype").val();
                if (actval == '' || typeval == ''){ show([1,2,3,11]); return; }
                if (actval == 3 || actval == 4){ show([1,2,3,11]); return; }
                if (typeval == 1){ show([1,2,4,5,6,7,8,9,10,11]); }
                if (typeval == 2){ show([1,2,4,7,9,10,11]); }
                if (typeval == 3){ show([1,2,4,5,7,8,9,10,11]); }
                if (typeval == 4){ show([1,2,4,9,10,11]);}
            }

            $(document).ready(function(){
                $("#menu a[href='/house/']").css({"color":"#F16522"});
                $("#id_actype").change(onchange);
                $("#id_ttype").change(onchange);
                onchange();
            })
        </script>

    </head>
    <body>
        <div class="wrapper">
            <div id="addArticle">
                <div class="head"> <span>发布租售信息</span> &gt; {{typeobj.name}} </div>

                <form method="POST" action="/house/add/">
                    {% csrf_token %}

                    <div class="p-line", id="t1">
                        <label class="title"><span style="color:red;">*</span>租/售:</label>
                        {{form.actype}}
                        {{form.actype.errors}}
                    </div>

                    <div class="p-line", id="t2">
                        <label class="title"><span style="color:red;">*</span>物业类型:</label>
                        {{form.ttype}}
                        {{form.ttype.errors}}
                    </div>

                    <div class="p-line", id="t3">
                        <label class="title"><span style="color:red;">*</span>标题:</label>
                        {{form.title}}
                        {{form.title.errors}}
                    </div>

                    <div class="p-line", id="t4">
                        <label class="title"><span style="color:red;">*</span>地址:</label>
                        {{form.addr}}
                        {{form.addr.errors}}
                    </div>

                    <div class="p-line", id="t5">
                        <label class="title"><span style="color:red;">*</span>楼层:</label>
                        {{form.floor}}
                        {{form.floor.errors}}
                    </div>

                    <div class="p-line", id="t6">
                        <label class="title"><span style="color:red;">*</span>户型:</label>
                        {{form.style}}
                        {{form.style.errors}}
                    </div>

                    <div class="p-line", id="t7">
                        <label class="title"><span style="color:red;">*</span>面积:</label>
                        {{form.area}}
                        {{form.area.errors}}
                    </div>

                    <div class="p-line", id="t8">
                        <label class="title"><span style="color:red;">*</span>装修:</label>
                        {{form.fitment}}
                        {{form.fitment.errors}}
                    </div>

                    <div class="p-line", id="t9">
                        <label class="title"><span style="color:red;">*</span>价格:</label>
                        {{form.price}}
                        {{form.price.errors}}
                    </div>

                    <div class="p-line", id="t10">
                        <label class="title"><span style="color:red;">*</span>房源:</label>
                        {{form.souce}}
                        {{form.souce.errors}}
                    </div>


                    <div class="p-line", id="t11">
                        <label class="title"><span style="color:red;">*</span>描述:</label>
                        {{form.desc}}
                        {{form.desc.errors}}
                    </div>

                    <div class="p-line">
                        <label class="title"><span style="color:red;">*</span>电话:</label>
                        {{form.phone}}
                        {{form.phone.errors}}
                    </div>

                    <div id="show"></div>
                    <div id="hidevar"></div>
                    <input class="btnSubmit"  type="submit" value="发表帖子" />
                </form>

                <iframe id="preview" name="preview" style="display:none;"></iframe>
                <form method="POST" action="/house/upload/" target="preview" enctype="multipart/form-data">
                    {% csrf_token %}
                    {{imgform.as_p}}
                    <input type="submit" value="upload" />
                </form>

            </div>
        </div>

    </body>
</html>

